import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('pipe')
export class pipe extends Component {
	@property
	speed:number = 50
    start() {

    }

    update(deltaTime: number) {
        for(let i of this.node.children){
			i.setPosition(
				i.getPosition().x-this.speed*deltaTime,
				i.getPosition().y
			)
			if(i.getPosition().x<-288){
				i.setPosition(
					i.getPosition().x+288*2,
					Math.random()*210-52
				)
			}
		}
		
    }
}

